<?php
require_once ("./commun/ouvre_base.php");

// ~ $link = mysql_connect($host, $userbase, $passwd) or die('Impossible de se connecter : ' . mysql_error());
mysql_select_db ( $db ) or die ( 'Impossible de s&#233;lectionner la base de donn&#233;es' );

$id = $_POST ['id'];
if (isset ( $_POST ['mdp'] )) {
	$mdp = $_POST ['mdp'];
}

$queryuser = "SELECT *
			FROM `users`
			WHERE `last_name` LIKE '$id';";
// ~ echo $queryuser;
$resultuser = mysql_query ( $queryuser ) or die ( "Impossible de r&#233;cup&#233;rer la liste des users" . mysql_error () );
$pwd = array ();
while ( $line = mysql_fetch_array ( $resultuser ) ) {
	$password = $line ['password'];
}

// ~ $password = $pwd[0];
$passwordsoumis = md5 ( $mdp );

if ($password == $passwordsoumis) {
	$authentification = 1;
} else {
	$authentification = 0;
}

?>
